<?php 
session_start();          
	require_once "../includes/config.php";
	
	$userId			= $_REQUEST['viewwhole'];
	$sqlSelProfile		= "select * from tbl_users where user_id=$userId";
	$rstSelProfile		= mysql_query($sqlSelProfile);
	$rowSelProfile		= mysql_fetch_array($rstSelProfile);
	
	$physicalLocation = $rowSelProfile['physicalLocation'];
	$bus_id 	= $rowSelProfile['bus_id'];
	
	$businessType	= '';
	if($bus_id!=0)
	{
		$qry = "select business_type from tbl_businesstype where bus_id='$bus_id' limit 1";
		$category = mysql_query($qry) or die(mysql_error());
		$c_category = mysql_num_rows($category);
		if($c_category==1)
		{
			$cat = mysql_fetch_array($category);
			$businessType = $cat['business_type'];
		}
	}
	
	$businessDescription = $rowSelProfile['businessDescription'];
	
	$userName	= $rowSelProfile['username'];
	$password	= $rowSelProfile['password'];
	$business	= $rowSelProfile['business_name'];
	$userType	= $rowSelProfile['user_type'];	
	$firstName	= $rowSelProfile['first_name'];	
	$lastName	= $rowSelProfile['last_name'];
	$email		= $rowSelProfile['email'];
	$businessEmail	= $rowSelProfile['businessEmail'];
	$question_id	= $rowSelProfile['secret_question'];
	$secret_answer	= $rowSelProfile['secret_answer'];
	$state		= $rowSelProfile['state'];	
	$country_id	= $rowSelProfile['country'];
	$city		= $rowSelProfile['city'];
	$zipcode	= $rowSelProfile['zip'];
	
	$address	= $rowSelProfile['address_line_1'];
	if($rowSelProfile['address_line_2']!='')
	$address.=", ".$rowSelProfile['address_line_2'];
	if($rowSelProfile['address_line_3']!='')
	$address.=", ".$rowSelProfile['address_line_3'];
	
	$password	= $rowSelProfile['password'];
	
	$phone1		= $rowSelProfile['phone_number_1'];
	$phone2		= $rowSelProfile['phone_number_2'];
	
	$driverLicence 	= $rowSelProfile['driverLicence'];
	
	$dob		= $rowSelProfile['dob'];
	
	
	$sellingStatus	= $rowSelProfile['selling_status'];
	$photoThumb	= $rowSelProfile['profile_thumb'];
	
	//to get country name
	$country = get_country_details($country_id);
	$country_name = $country['country_name'];
	
	//to get seceret question
	$question = '';
	$qry = "select question from tbl_questions where question_id=$question_id";
	$tbl_questions = mysql_query($qry)  or die(mysql_error());
	$cnt_qry = mysql_num_rows($tbl_questions);
	if($cnt_qry==1)
	{
		$que = mysql_fetch_array($tbl_questions);
		$question = $que['question'];
	}
	
	
	$sellingStatus		= $rowSelProfile['selling_status'];
	$photoThumb		= $rowSelProfile['profile_thumb'];
	
	
	?>
<style type="text/css">
	table#tbl-profile tr td { vertical-align:middle; }
</style>
<table width="100%" height="611"  border="1" cellspacing="0" class='container'>
	<tr><td height="26" class="tdHeader">Members Profile </td></tr>
	<tr>
		<td>
			<table id="tbl-profile" width="80%" align="center"  border="0" cellspacing="0" cellpadding="0">
				<tr><td colspan="3" height="35">&nbsp;</td></tr>
				<tr>
					<td colspan="3">
					<?php 
					if($photoThumb!="") {
						echo "<img src='../$photoThumb'>";
					}
					?>
					</td>
				</tr>
				<?php
				if($userType==5) { ?>
				<tr>
					<td height="28" colspan="3" style="text-align:right"><a href="index.php?viewInv&mid=<?php echo $userId?>" target="_blank">View Wholeseller`s inventory</a></td>
				</tr><?php } ?>
				
				<tr>
					<th colspan="3" align="center">Business Information</th>
				</tr>
				
				<tr>
					<td width="37">&nbsp;</td>
					<td width="215" height="33"><b>Business name</b> </td>
					<td width="380" height="33"><?php echo $business; ?></td>
				</tr>
				
				<tr>
					<td width="37" bgcolor="#FBF1F1">&nbsp;</td>
					<td width="215" height="33" bgcolor="#FBF1F1"><b>Physical Location</b> </td>
					<td width="380" height="33" bgcolor="#FBF1F1"><?php echo $physicalLocation; ?></td>
				</tr>
				
				<tr>
					<td width="37">&nbsp;</td>
					<td width="215" height="33"><b>Business Type</b> </td>
					<td width="380" height="33"><?php echo $businessType; ?></td>
				</tr>
				
				<tr>
					<td width="37" bgcolor="#FBF1F1">&nbsp;</td>
					<td width="215" height="33" bgcolor="#FBF1F1"><b>Business Description</b> </td>
					<td width="380" height="33" bgcolor="#FBF1F1"><?php echo $businessDescription; ?></td>
				</tr>
				
				<tr>
					<td>&nbsp;</td>
					<td height="33"><b>Business Address</b></td>
					<td height="33"><?php echo $address; ?></td>
				</tr>
				
				<tr>
					<td bgcolor="#FBF1F1">&nbsp;</td>
					<td height="33" bgcolor="#FBF1F1"><b>Country/Region</b></td>       
					<td height="33" bgcolor="#FBF1F1"> <?php  echo $country_name; ?> </td>
				</tr>
				
				<tr>
					<td>&nbsp;</td>
					<td height="33"><b>State/Province</b></td>
					<td height="33"> <?php echo $state; ?> </td>
				</tr>
				
				<tr>
					<td bgcolor="#FBF1F1">&nbsp;</td>
					<td height="33" bgcolor="#FBF1F1"><b>City</b></td>
					<td height="33" bgcolor="#FBF1F1"> <?php echo $city; ?> </td>
				</tr>
				 
				<tr>
					<td>&nbsp;</td>
					<td height="33"><b>Zipcode</b></td>       
					<td height="33"> <?php  echo $zipcode; ?> </td>
				</tr>
				
				<tr>
					<td bgcolor="#FBF1F1">&nbsp;</td>
					<td height="33" bgcolor="#FBF1F1"><b>Telephone</b></td>       
					<td height="33" bgcolor="#FBF1F1"> <?php  echo $phone1; ?> </td>
				</tr>
				
				<tr>
					<td>&nbsp;</td>
					<td height="33"><b>Email</b></td>
					<td height="33"><?php echo $email; ?></td>
				</tr>
				
				
				
				<tr>
					<th colspan="3" align="center" bgcolor="#FBF1F1" height="33">Business Contact Information</th>
				</tr>
				
				<tr>
					<td align="center">&nbsp;</td>
					<td height="33"><b>First name</b> </td>
					<td height="33" align="center"><?php echo $firstName; ?></td>
				</tr>
			       
				<tr>
					<td bgcolor="#FBF1F1">&nbsp;</td>
					<td height="33" bgcolor="#FBF1F1"><b>Last name</b> </td>
					<td height="33" bgcolor="#FBF1F1"><?php echo $lastName; ?></td>
				</tr>
				
				<tr>
					<td>&nbsp;</td>
					<td height="33"><b>Telephone</b></td>       
					<td height="33"> <?php  echo $phone2; ?> </td>
				</tr>
				
				<tr>
					<td bgcolor="#FBF1F1">&nbsp;</td>
					<td height="33" bgcolor="#FBF1F1"><b>Email</b></td>
					<td height="33" bgcolor="#FBF1F1"><?php echo $businessEmail; ?></td>
				</tr>
				
				<tr>
					<td width="37">&nbsp;</td>
					<td width="215" height="33"><b>Driver Licence</b> </td>
					<td width="380" height="33"><?php echo $driverLicence; ?></td>
				</tr>
				
				<tr>
					<th colspan="3" align="center" height="33" bgcolor="#FBF1F1">Security Information</th>
				</tr>
				
				<tr>
					<td width="37">&nbsp;</td>
					<td width="215" height="33"><b>User name</b> </td>
					<td width="380" height="33"><?php echo $userName; ?></td>
				</tr>
				
				<tr>
					<td width="37" bgcolor="#FBF1F1">&nbsp;</td>
					<td width="215" height="33" bgcolor="#FBF1F1"><b>Password</b> </td>
					<td width="380" bgcolor="#FBF1F1" height="33"><?php echo $password; ?></td>
				</tr>
				
				<tr>
					<td>&nbsp;</td>
					<td height="33"><b>User type</b> </td>
					<td height="33"><?php 
					if($userType==1) {
						if($sellingStatus==1) {
							echo "Seller";
						} else {  echo "Buyer"; }
				 
					}
					else if($userType==2) echo "Merchant"; 
					else if($userType==3) echo "Merchant";
					 ?>		
					</td>
				</tr>
				
				
				
				
				<tr>
					<td bgcolor="#FBF1F1">&nbsp;</td>
					<td height="33" bgcolor="#FBF1F1"><b>Secret Question</b> </td>
					<td height="33" bgcolor="#FBF1F1"><?php echo $question; ?></td>
				</tr>
				
				<tr>
					<td>&nbsp;</td>
					<td height="33"><b>Answer</b></td>
					<td height="33"><?php echo $secret_answer; ?></td>
				</tr>
				
				<tr>
					<td bgcolor="#FBF1F1">&nbsp;</td>
					<td height="33" bgcolor="#FBF1F1"><b>Date of Birth</b> </td>
					<td height="33" bgcolor="#FBF1F1"><?php echo $dob; ?></td>
				</tr>
				<tr>
					<td>&nbsp;</td>
					<td height="98" colspan="2" ><a href="index.php?wholeseller">Back To List</a></td>
				</tr>
			</table>
		</td>
	</tr>
</table>
